
from __future__ import unicode_literals

from pyecharts import Bar, Scatter3D
from pyecharts import Page



#bar = Bar(title="我的第一个图表", subtitle="这里是副标题",title_color='#000')
#bar.add("服装", 
#        ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"], [5, 20, 36, 10, 75, 90],
#        is_more_utils=True)
#bar.render('标题.html')

page = Page()

chart = Bar('数量比例',title_color='#000',  width=1200, height=600)
chart.add('', ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"], [5, 20, 36, 10, 75, 90], is_stack=True, is_convert=True, label_pos='inside', is_legend_show=True,is_label_show=True,is_more_utils=True)
page.add(chart)

page.render('ssss.html')


#page = Page()         # step 1

## bar
#attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
#v1 = [5, 20, 36, 10, 75, 90]
#v2 = [10, 25, 8, 60, 20, 80]
#bar = Bar("柱状图数据堆叠示例",'副标题')
#bar.add("商家A", attr, v1, is_stack=True)
#bar.add("商家B", attr, v2, is_stack=True)
#page.add(bar)         # step 2

## scatter3D
#import random
#data = [
#    [random.randint(0, 100),
#    random.randint(0, 100),
#    random.randint(0, 100)] for _ in range(80)
#]
#range_color = [
#    '#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf',
#    '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026']
#scatter3D = Scatter3D("3D 散点图示例",'3D的副标题', width=1200, height=600)
#scatter3D.add("", data, is_visualmap=True, visual_range_color=range_color)
#page.add(scatter3D)  # step 2

#page.render('my_first_chart.html')        # step 3